#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <string.h>
using std::cout;
using std::cin;
using std::endl;
const int MAXN = 2e3+7;
double Res[MAXN];
struct node {
    double p;
    int num;
};
node arr[1007];

int main(int argc, char** argv) {
#ifdef hai
    freopen("in.txt", "r", stdin);
#endif
    int n;
    int cnt, num;
    double p;
    while (scanf("%d", &n)) {
        if (!n) break;
        cnt = 0;
        for (int i=0; i<n; ++i) {
            scanf("%lf %d", &p, &num);
            cnt += num;
            arr[i].p = p;
            arr[i].num = num;
        }
        memset(Res, 0, sizeof(Res));
        Res[0] = 1.0;
        for (int i=0; i<n; ++i) {
            int t = arr[i].num;
            p = arr[i].p;
            for (int j=cnt; j>=0; --j) {
                Res[j] = (1-p) * Res[j];
                if (j-t >= 0) {
                    Res[j] += Res[j-t] * p;
                }
            }
        }
        int mid = (cnt+1) / 2;
        double ans = 0.0;
        for (int i=mid; i<=cnt; ++i) {
            ans += Res[i];
        }
        printf("%0.4lf\n", ans);
    }
    return 0;
}
